//package com.xqboss.chain.bsn;
//
//import com.reddate.wuhanddc.DDCSdkClient;
//import com.reddate.wuhanddc.listener.SignEventListener;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import java.math.BigInteger;
//
//
//@Slf4j
//@Component
//public class ChargeServiceUtil {
//
//    @Value("${custom.nft.sendAddress}")
//    String sendAddress;
//
//
//    /**
//     * 运营方、平台方调用该接口为所属同一方的同一级别账户或者下级账户充值账户余额；
//     *
//     * @param to     充值账户的地址
//     * @param amount 充值金额 单位按分
//     * @return 返回交易哈希
//     * @throws Exception
//     */
//    public String recharge(BigInteger amount, String to) {
//        // sign event listener
//        SignEventListener signEventListener = event -> AuthorityServiceUtil.transactionSignature(event.getSender(), event.getRawTransaction());
//        // ddcSdkClient instantiation
//        DDCSdkClient ddcSdkClient = DDCSdkClient.builder().setSignEventListener(signEventListener).build();
//
//        String txHash = null;
//        try {
//            txHash = ddcSdkClient.chargeService.recharge(sendAddress, to, amount);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        log.info(txHash);
////        assertNotNull(txHash);
//        return txHash;
//    }
//
//
////
////    private static String transactionSignature(String sender, RawTransaction transaction) {
////        // sender: Obtain the private key according to the sender and complete its signature
////
////        //sender privateKey
////        String privateKey = "0x20bd77e9c6c920cba10f4ef3fdd10e0cfbf8a4781292d8c8d61e37458445888";
////        Credentials credentials = Credentials.create(privateKey);
////        byte[] signedMessage = TransactionEncoder.signMessage(transaction, 5555, credentials);
////        return Numeric.toHexString(signedMessage);
////    }
////
////    @Test
////    public void selfRecharge() throws Exception {
////        // recharge amount
////        BigInteger amount = new BigInteger("1000");
////        String txHash = ddcSdkClient.chargeService.selfRecharge(sender, amount);
////        log.info(txHash);
//////        assertNotNull(txHash);
////    }
////
////
////
////
////    @Test
////    public void balanceOf() throws Exception {
////        // account address
////        String accAddr = "0x019ba4600e117f06e3726c0b100a2f10ec52339e";
////        BigInteger amount = ddcSdkClient.chargeService.balanceOf(accAddr);
////        log.info(String.valueOf(amount));
//////        assertNotNull(amount);
////    }
////
////
////    @Test
////    public void queryFee() throws Exception {
////        // 721 contract
////        String ddcAddr = "0xb4B46D6B2C7BC4389759f9EBE141cFE086771561";
////
////        // mint sig
////        String sig = "0xd0def521";
////
////        BigInteger fee = ddcSdkClient.chargeService.queryFee(ddcAddr, sig);
//////        assertNotNull(fee);
////        log.info(String.valueOf(fee));
////    }
////
////
////    @Test
////    public void set721Fee() throws Exception {
////
////        // 721 contract
////        String ddcAddr = "0xb4B46D6B2C7BC4389759f9EBE141cFE086771561";
////
////        // fee
////        BigInteger amount = new BigInteger("100");
////
////        ArrayList<String> sigList = new ArrayList<>();
////        sigList.add("0xe985e9c5");
////
////        for (int i = 0; i < sigList.size(); i++) {
////            String txHash = ddcSdkClient.chargeService.setFee(sender, ddcAddr, sigList.get(i), amount);
//////            assertNotNull(txHash);
////            log.info(txHash);
////        }
////
////    }
////
////    @Test
////    public void set1155Fee() throws Exception {
////
////        // 1155 contract
////        String ddcAddr = "0x5Bf9e07aBBF0cFbF21d02065529AE10e2Ef0a375";
////
////        // fee
////        BigInteger amount = new BigInteger("1");
////
////        ArrayList<String> sigList = new ArrayList<>();
////
////        // safeMint sig
////        String safeMint = "0xb55bc617";
////        sigList.add(safeMint);
////
////        for (int i = 0; i < sigList.size(); i++) {
////
////            String txHash = ddcSdkClient.chargeService.setFee(sender, ddcAddr, sigList.get(i), amount);
//////            assertNotNull(txHash);
////            log.info(txHash);
////            Thread.sleep(1000 * 14);
////        }
////
////    }
////
////
////    @Test
////    public void delFee() throws Exception {
////
////        // 1155 contract
////        String ddcAddr = "0x5Bf9e07aBBF0cFbF21d02065529AE10e2Ef0a375";
////
////        // safeMint sig
////        String sig = "0xb55bc617";
////
////        String txHash = ddcSdkClient.chargeService.delFee(sender, ddcAddr, sig);
////        log.info(txHash);
//////        assertNotNull(txHash);
////    }
////
////
////    @Test
////    public void delDDC() throws Exception {
////
////        // 1155 contract
////        String ddcAddr = "0x5Bf9e07aBBF0cFbF21d02065529AE10e2Ef0a375";
////
////        String txHash = ddcSdkClient.chargeService.delDDC(sender, ddcAddr);
////        log.info(txHash);
//////        assertNotNull(txHash);
////    }
//
//
//}
